package Semester_2.src.Util_5;

import java.io.*;
import java.net.Socket;

public class ClientSavesFile {
    public static void main(String[] args) throws IOException {
        Socket s=new Socket("10.210.50.20",33680);
        OutputStream os=s.getOutputStream();
        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(os));
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String s1;
        while((s1=br.readLine())!=null){
            if("exit".equals(s1)){
                break;
            }
            bw.write(s1);
            bw.newLine();
            bw.flush();
        }
        s.shutdownOutput();

        BufferedReader bur=new BufferedReader(new InputStreamReader(s.getInputStream()));
        String st;
        while((st=bur.readLine())!=null){
            System.out.println(st);
        }
        s.close();
    }
}